package shizhong;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class TimerMain extends JFrame {

    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private TimerPanel tp;

    public TimerMain() {
        setSize(600, 600);
        setVisible(true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
        setLocation((int) (screensize.getWidth() - 600) / 2, (int) (screensize.getHeight() - 600) / 2);
        tp = new TimerPanel();
        tp.repaint();
        setContentPane(tp);
        TimerThread tr = new TimerThread(tp);
        Thread th = new Thread(tr);
        th.start();
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                new TimerMain();
            }
        });
    }

}
